# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 16:22
# @Author  : qd
# @Email   : 1518603573@qq.com
# @File    : fiance_fkd_page.py
# @Software: PyCharm

from pages.base_page import BasePage
from selenium.webdriver.common.by import By
"""付款单界面"""
class FkdPage(BasePage):
    url="/crm/index.php?m=finance&a=index&t=paymentorder"
    """添加付款单按钮定位器"""
    fkd_btn_add_locator=(By.CSS_SELECTOR,"body > div.container > div.row > div:nth-child(1) > div.pull-right > a")
    """选中要删除的付款单定位器"""
    fkd_select_locator = (By.CSS_SELECTOR, "#form1 > table > tbody > tr:nth-child(1) > td:nth-child(1) > input")
    """付款单删除按钮"""
    fkd_btn_delete_locator = (By.ID, "delete")
    """搜索付款单关键字输入框"""
    fkd_input_search_locator = (By.CSS_SELECTOR, "#search")
    """搜索按钮"""
    fkd_btn_search_locator = (By.CSS_SELECTOR, "#searchForm > ul > li:nth-child(4) > button")
    """获取搜索后的付款单文本"""
    fkd_after_search_text_locator=(By.CSS_SELECTOR,"#form1 > table > tbody > tr:nth-child(1) > td:nth-child(2) > a")
    """点击添加付款单按钮"""
    def click_fkd_btn_add(self):
        self.driver.find_element(*self.fkd_btn_add_locator).click()
    """选中要删除的付款单"""
    def click_fkd_select(self):
        self.driver.find_element(*self.fkd_select_locator).click()
    """点击删除"""
    def click_fkd_btn_delete(self):
        self.driver.find_element(*self.fkd_btn_delete_locator).click()
    """点击确定删除"""
    def click_fkd_alert(self):
        self.driver.switch_to.alert.accept()
    """输入要搜索的关键字"""
    def input_fkd_search(self,fkd_keywords):
        self.driver.find_element(*self.fkd_input_search_locator).send_keys(fkd_keywords)
    """点击搜索"""
    def click_fkd_btn_search(self):
        self.driver.find_element(*self.fkd_btn_search_locator).click()
    """"获取搜索后的文本"""
    def get_fkd_after_search_text(self):
        return self.driver.find_element(*self.fkd_after_search_text_locator).text.strip()
